package com.abu.abuaidemo.controller;

import org.springframework.ai.client.AiClient;
import org.springframework.ai.prompt.messages.AssistantMessage;
import org.springframework.ai.prompt.messages.UserMessage;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1")
@CrossOrigin
public class AiController {
    private final AiClient aiClient;

    public AiController(AiClient aiClient) {
        this.aiClient = aiClient;
    }

    @GetMapping("/chat")
    public String chat(
            @RequestParam(value = "message",defaultValue = "Hi") String message
    ){
        System.out.println("aaa");
        return aiClient.generate(message);
    }
}
